.class public Lcom/teewoo/app/bus/util/Utils;
.super Ljava/lang/Object;
.source "Utils.java"


# static fields
.field public static final CONNECT_FLAG:Ljava/lang/String; = "\u2192"

.field public static EARTH_RADIUS:D = 0.0

.field public static final ENCODE_UTF:Ljava/lang/String; = "utf-8"

.field public static final PACKAGE_NAME:Ljava/lang/String; = "com.teewoo.app.bus"


# direct methods
.method static constructor <clinit>()V
    .locals 2

    .prologue
    .line 115
    const-wide v0, 0x40b8ea23126e978dL

    sput-wide v0, Lcom/teewoo/app/bus/util/Utils;->EARTH_RADIUS:D

    .line 16
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 16
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static checkGoogleMap(Landroid/content/Context;)Z
    .locals 5
    .parameter "context"

    .prologue
    .line 84
    const/4 v2, 0x0

    .line 85
    .local v2, isInstallGMap:Z
    invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v4

    invoke-virtual {v4}, Landroid/content/pm/PackageManager;->getSystemSharedLibraryNames()[Ljava/lang/String;

    move-result-object v3

    .line 86
    .local v3, sharedLibrary:[Ljava/lang/String;
    if-eqz v3, :cond_0

    .line 87
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    array-length v4, v3

    if-lt v1, v4, :cond_1

    .line 95
    .end local v1           #i:I
    :cond_0
    :goto_1
    return v2

    .line 88
    .restart local v1       #i:I
    :cond_1
    aget-object v0, v3, v1

    .line 89
    .local v0, googleStr:Ljava/lang/String;
    const-string v4, "com.google.android.maps"

    invoke-virtual {v4, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v4

    if-eqz v4, :cond_2

    .line 90
    const/4 v2, 0x1

    .line 91
    goto :goto_1

    .line 87
    :cond_2
    add-int/lit8 v1, v1, 0x1

    goto :goto_0
.end method

.method public static getDistance(DDDD)I
    .locals 4
    .parameter "lat1"
    .parameter "lng1"
    .parameter "lat2"
    .parameter "lng2"

    .prologue
    .line 125
    invoke-static {p0, p1}, Lcom/teewoo/app/bus/util/Utils;->rad(D)D

    move-result-wide v0

    .line 126
    .local v0, radLat1:D
    invoke-static {p4, p5}, Lcom/teewoo/app/bus/util/Utils;->rad(D)D

    move-result-wide p4

    .line 127
    .local p4, radLat2:D
    sub-double p0, v0, p4

    .line 128
    .local p0, a:D
    invoke-static {p2, p3}, Lcom/teewoo/app/bus/util/Utils;->rad(D)D

    move-result-wide p2

    .end local p2
    invoke-static {p6, p7}, Lcom/teewoo/app/bus/util/Utils;->rad(D)D

    move-result-wide p6

    .end local p6
    sub-double/2addr p2, p6

    .line 130
    .local p2, b:D
    const-wide/high16 p6, 0x4000

    const-wide/high16 v2, 0x4000

    div-double/2addr p0, v2

    invoke-static {p0, p1}, Ljava/lang/Math;->sin(D)D

    .end local p0           #a:D
    move-result-wide p0

    const-wide/high16 v2, 0x4000

    invoke-static {p0, p1, v2, v3}, Ljava/lang/Math;->pow(DD)D

    move-result-wide p0

    .line 131
    invoke-static {v0, v1}, Ljava/lang/Math;->cos(D)D

    move-result-wide v0

    .end local v0           #radLat1:D
    invoke-static {p4, p5}, Ljava/lang/Math;->cos(D)D

    move-result-wide p4

    .end local p4           #radLat2:D
    mul-double/2addr p4, v0

    const-wide/high16 v0, 0x4000

    div-double/2addr p2, v0

    invoke-static {p2, p3}, Ljava/lang/Math;->sin(D)D

    .end local p2           #b:D
    move-result-wide p2

    const-wide/high16 v0, 0x4000

    invoke-static {p2, p3, v0, v1}, Ljava/lang/Math;->pow(DD)D

    move-result-wide p2

    mul-double/2addr p2, p4

    add-double/2addr p0, p2

    .line 130
    invoke-static {p0, p1}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide p0

    invoke-static {p0, p1}, Ljava/lang/Math;->asin(D)D

    move-result-wide p0

    mul-double/2addr p0, p6

    .line 133
    .local p0, s:D
    sget-wide p2, Lcom/teewoo/app/bus/util/Utils;->EARTH_RADIUS:D

    mul-double/2addr p0, p2

    .line 134
    const-wide p2, 0x40c3880000000000L

    mul-double/2addr p0, p2

    const-wide p2, 0x408f400000000000L

    mul-double/2addr p0, p2

    invoke-static {p0, p1}, Ljava/lang/Math;->round(D)J

    .end local p0           #s:D
    move-result-wide p0

    const-wide/16 p2, 0x2710

    div-long/2addr p0, p2

    long-to-double p0, p0

    .line 135
    .restart local p0       #s:D
    double-to-int p0, p0

    .end local p0           #s:D
    return p0
.end method

.method public static getJustTime()Ljava/lang/String;
    .locals 3

    .prologue
    .line 56
    new-instance v1, Landroid/text/format/Time;

    const-string v2, "Asia/Hong_Kong"

    invoke-direct {v1, v2}, Landroid/text/format/Time;-><init>(Ljava/lang/String;)V

    .line 57
    .local v1, localTime:Landroid/text/format/Time;
    invoke-virtual {v1}, Landroid/text/format/Time;->setToNow()V

    .line 58
    const-string v2, "%H:%M:%S"

    invoke-virtual {v1, v2}, Landroid/text/format/Time;->format(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 59
    .local v0, formatTime:Ljava/lang/String;
    return-object v0
.end method

.method public static getLocCurrentTime()Ljava/lang/String;
    .locals 3

    .prologue
    .line 45
    new-instance v1, Landroid/text/format/Time;

    const-string v2, "Asia/Hong_Kong"

    invoke-direct {v1, v2}, Landroid/text/format/Time;-><init>(Ljava/lang/String;)V

    .line 46
    .local v1, localTime:Landroid/text/format/Time;
    invoke-virtual {v1}, Landroid/text/format/Time;->setToNow()V

    .line 47
    const-string v2, "%m\u6708%d\u65e5  %H:%M:%S"

    invoke-virtual {v1, v2}, Landroid/text/format/Time;->format(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 48
    .local v0, formatTime:Ljava/lang/String;
    return-object v0
.end method

.method public static getLocDate()Ljava/lang/String;
    .locals 3

    .prologue
    .line 35
    new-instance v1, Landroid/text/format/Time;

    const-string v2, "Asia/Hong_Kong"

    invoke-direct {v1, v2}, Landroid/text/format/Time;-><init>(Ljava/lang/String;)V

    .line 36
    .local v1, localTime:Landroid/text/format/Time;
    invoke-virtual {v1}, Landroid/text/format/Time;->setToNow()V

    .line 37
    const-string v2, "%y\u5e74%m\u6708%d\u65e5"

    invoke-virtual {v1, v2}, Landroid/text/format/Time;->format(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 38
    .local v0, formatTime:Ljava/lang/String;
    return-object v0
.end method

.method public static getLocFullTime()Ljava/lang/String;
    .locals 3

    .prologue
    .line 25
    new-instance v1, Landroid/text/format/Time;

    const-string v2, "Asia/Hong_Kong"

    invoke-direct {v1, v2}, Landroid/text/format/Time;-><init>(Ljava/lang/String;)V

    .line 26
    .local v1, localTime:Landroid/text/format/Time;
    invoke-virtual {v1}, Landroid/text/format/Time;->setToNow()V

    .line 27
    const-string v2, "%y\u5e74%m\u6708%d\u65e5  %H:%M:%S"

    invoke-virtual {v1, v2}, Landroid/text/format/Time;->format(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 28
    .local v0, formatTime:Ljava/lang/String;
    return-object v0
.end method

.method public static getNetworkStatus(Landroid/content/Context;)Z
    .locals 2
    .parameter "context"

    .prologue
    .line 101
    const-string v1, "connectivity"

    invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    .line 102
    .local v0, cm:Landroid/net/ConnectivityManager;
    invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object v1

    if-eqz v1, :cond_0

    .line 103
    invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object v1

    invoke-virtual {v1}, Landroid/net/NetworkInfo;->isAvailable()Z

    move-result v1

    .line 104
    :goto_0
    return v1

    :cond_0
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public static highlightKeyword(Ljava/lang/String;Ljava/lang/String;I)Landroid/text/SpannableStringBuilder;
    .locals 7
    .parameter "source"
    .parameter "target"
    .parameter "color"

    .prologue
    .line 141
    new-instance v3, Landroid/text/SpannableStringBuilder;

    invoke-direct {v3, p0}, Landroid/text/SpannableStringBuilder;-><init>(Ljava/lang/CharSequence;)V

    .line 142
    .local v3, spannable:Landroid/text/SpannableStringBuilder;
    const/4 v2, 0x0

    .line 144
    .local v2, span:Landroid/text/style/CharacterStyle;
    invoke-static {p1}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;

    move-result-object v1

    .line 145
    .local v1, p:Ljava/util/regex/Pattern;
    invoke-virtual {v1, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;

    move-result-object v0

    .line 146
    .local v0, m:Ljava/util/regex/Matcher;
    :goto_0
    invoke-virtual {v0}, Ljava/util/regex/Matcher;->find()Z

    move-result v4

    if-nez v4, :cond_0

    .line 151
    return-object v3

    .line 147
    :cond_0
    new-instance v2, Landroid/text/style/ForegroundColorSpan;

    .end local v2           #span:Landroid/text/style/CharacterStyle;
    invoke-direct {v2, p2}, Landroid/text/style/ForegroundColorSpan;-><init>(I)V

    .line 148
    .restart local v2       #span:Landroid/text/style/CharacterStyle;
    invoke-virtual {v0}, Ljava/util/regex/Matcher;->start()I

    move-result v4

    invoke-virtual {v0}, Ljava/util/regex/Matcher;->end()I

    move-result v5

    .line 149
    const/16 v6, 0x21

    .line 148
    invoke-virtual {v3, v2, v4, v5, v6}, Landroid/text/SpannableStringBuilder;->setSpan(Ljava/lang/Object;III)V

    goto :goto_0
.end method

.method public static intervalBetweenTimes(Ljava/lang/String;Ljava/lang/String;)J
    .locals 10
    .parameter "lastTime"
    .parameter "nowTime"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 161
    new-instance v8, Ljava/text/SimpleDateFormat;

    const-string v9, "yy\u5e74MM\u6708dd\u65e5 hh:mm:ss"

    invoke-direct {v8, v9}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V

    .line 162
    .local v8, strToDate:Ljava/text/SimpleDateFormat;
    const-wide/16 v6, 0x0

    .line 164
    .local v6, interval:J
    invoke-virtual {v8, p0}, Ljava/text/SimpleDateFormat;->parse(Ljava/lang/String;)Ljava/util/Date;

    move-result-object v0

    .line 165
    .local v0, date1:Ljava/util/Date;
    invoke-virtual {v8, p1}, Ljava/text/SimpleDateFormat;->parse(Ljava/lang/String;)Ljava/util/Date;

    move-result-object v1

    .line 167
    .local v1, date2:Ljava/util/Date;
    invoke-virtual {v0}, Ljava/util/Date;->getTime()J

    move-result-wide v2

    .line 168
    .local v2, datetime1:J
    invoke-virtual {v1}, Ljava/util/Date;->getTime()J

    move-result-wide v4

    .line 170
    .local v4, datetime2:J
    sub-long v6, v4, v2

    .line 171
    return-wide v6
.end method

.method public static isAllLetters(Ljava/lang/String;)Z
    .locals 6
    .parameter "src"

    .prologue
    const/4 v5, 0x0

    .line 67
    invoke-virtual {p0}, Ljava/lang/String;->toCharArray()[C

    move-result-object v1

    .line 68
    .local v1, cArray:[C
    array-length v2, v1

    move v3, v5

    :goto_0
    if-lt v3, v2, :cond_0

    .line 74
    const/4 v2, 0x1

    :goto_1
    return v2

    .line 68
    :cond_0
    aget-char v0, v1, v3

    .line 69
    .local v0, c:C
    if-ltz v0, :cond_1

    const/16 v4, 0xff

    if-gt v0, v4, :cond_1

    .line 68
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    :cond_1
    move v2, v5

    .line 72
    goto :goto_1
.end method

.method private static rad(D)D
    .locals 4
    .parameter "x"

    .prologue
    .line 112
    const-wide v0, 0x400921fb54442d18L

    mul-double/2addr v0, p0

    const-wide v2, 0x4066800000000000L

    div-double/2addr v0, v2

    return-wide v0
.end method
